import rxAjax from '@/assets/js/ajax.js';

//自定义页面栏目 api接口
export const CustomPageColumnApi = {};

CustomPageColumnApi.baseUrl = '/api-portal/portal/core/customPageColumn';
CustomPageColumnApi.exportUrl = CustomPageColumnApi.baseUrl + '/listExport';

//查询列表
CustomPageColumnApi.query = function (parameter) {
    var url = CustomPageColumnApi.baseUrl + '/query';
    return rxAjax.postJson(url, parameter).then(res => {
        return res.result
    })
}

/**
 * 获取单记录
 * @param pkId
 * @returns {*}
 */
CustomPageColumnApi.get = function (pkId) {
    var url = CustomPageColumnApi.baseUrl + '/get?pkId=' + pkId;
    return rxAjax.get(url);
}

//保存数据
CustomPageColumnApi.save = function (parameter) {
    var url = CustomPageColumnApi.baseUrl + '/save';
    return rxAjax.postJson(url, parameter);
}

//删除数据
CustomPageColumnApi.del = function (parameter) {
    var url = CustomPageColumnApi.baseUrl + '/del';
    return rxAjax.postUrl(url, parameter);
}

/**
 * 根据别名获取栏目
 * @param pkId
 * @returns {*}
 */
CustomPageColumnApi.getByAlias = function (alias) {
    var url = CustomPageColumnApi.baseUrl + '/getByAlias?alias=' + alias;
    return rxAjax.get(url);
}

CustomPageColumnApi.updExport =function(ids) {
    var url= CustomPageColumnApi.baseUrl + '/updExport';
    return rxAjax.postForm(url,{ids:ids});
}

export default CustomPageColumnApi;

